<template>
  <van-tabs
    @click="onClick"
    line-width="60px"
    title-active-color="#ff5f16"
    color="#ff5f16"
    v-model="active"
  >
    <van-tab title="正在热映"></van-tab>
    <van-tab title="即将上映"></van-tab>
  </van-tabs>
</template>
<script>
import Vue from 'vue'
import { Tab, Tabs } from 'vant'

Vue.use(Tab)
Vue.use(Tabs)
export default {
  created() {
    console.log(this.$route.path)
    let path = this.$route.path
    let index = this.urlArr.indexOf(path)
    if (index < 0 && path === '/movie/future') {
      index = 0
    }
    this.active = index
  },
  data() {
    return {
      active: 0,
      urlArr: ['/movie/playing', '/movie/future']
    }
  },
  methods: {
    onClick(index, title) {
      this.$router.push(this.urlArr[index])
    }
  }
}
</script>
<style scoped>
</style>
